﻿<controls:ChildWindow x:Class="LEEAAttendanceControl.Views.ShiftAssignmentEdit"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
           xmlns:my="clr-namespace:LEEAAttendanceControl.Web.Services"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           Width="650" Height="400" 
           Title="Edit Employee Shifts">
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.Resources>
            <LinearGradientBrush x:Key="BackRectangleBrush" EndPoint=".7,1" StartPoint=".7,0">
                <GradientStop Color="#FCFFFFFF" Offset="0.015"/>
                <GradientStop Color="#F7FFFFFF" Offset="0.375"/>
                <GradientStop Color="#E5FFFFFF" Offset="0.6"/>
                <GradientStop Color="#D1FFFFFF" Offset="1"/>
            </LinearGradientBrush>
        </Grid.Resources>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="190" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <Grid Grid.Row="0" Margin="10" HorizontalAlignment="Center">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="110"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="55"/>
                <ColumnDefinition Width="85"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <sdk:Label Content="Employee Name:" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
                       Margin="3"/>
            <TextBox x:Name="NameBox" Grid.Column="1" Width="170" IsEnabled="False" Margin="3"/>
            
            <sdk:Label Content="Department:" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center"
                       Margin="3"/>
            <TextBox x:Name="DepartmentBox" Grid.Column="4" Width="150" IsEnabled="False" Margin="3"/>
        </Grid>
        
        <Grid Grid.Row="1" HorizontalAlignment="Center" Margin="20">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="111"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="55"/>
                <ColumnDefinition Width="105"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <sdk:Label Content="Assignment From:" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
                       Margin="3"/>
            <sdk:DatePicker x:Name="FromPicker" Grid.Column="1" Width="150" Margin="3" IsEnabled="False"/>

            <sdk:Label Content="Assignment To:" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center"
                       Margin="3"/>
            <sdk:DatePicker x:Name="ToPicker" Grid.Column="4" Width="150" Margin="3" IsEnabled="False"/>
        </Grid>
        
        <StackPanel Grid.Row="2" HorizontalAlignment="Center" Margin="5">
            <riaControls:DomainDataSource x:Name="ShiftsDataSource" AutoLoad="True" QueryName="GetShiftsByCompanyID"
                                          LoadingData="ShiftsDataSource_LoadingData">
                <riaControls:DomainDataSource.DomainContext>
                    <my:LEEAContext />
                </riaControls:DomainDataSource.DomainContext>
            </riaControls:DomainDataSource>
            
            <sdk:DataGrid x:Name="ShiftsGrid" AutoGenerateColumns="False" CanUserReorderColumns="False"
                          CanUserResizeColumns="False" CanUserSortColumns="False" MaxHeight="175"
                          VerticalScrollBarVisibility="Auto" ItemsSource="{Binding Data, ElementName=ShiftsDataSource}">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTemplateColumn Header="Shift" CanUserReorder="False" CanUserResize="False" Width="122">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid Margin="0" Background="{Binding Color}">
                                    <sdk:Label Content="{Binding ShiftName}" Margin="5,0,0,0" HorizontalAlignment="Left"
                                               VerticalAlignment="Center" Height="23" Foreground="{Binding ForeColor}"/>
                                </Grid>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn Width="65">
                        <sdk:DataGridTemplateColumn.HeaderStyle>
                            <Style TargetType="sdk:DataGridColumnHeader">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Grid>
                                                <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                <TextBlock Text="Sat" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </sdk:DataGridTemplateColumn.HeaderStyle>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid Margin="0" Background="{Binding Color}">
                                    <CheckBox x:Name="SatCheck" HorizontalAlignment="Center" VerticalAlignment="Center"
                                              Click="SatCheck_Click"/>
                                </Grid>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn Width="65">
                        <sdk:DataGridTemplateColumn.HeaderStyle>
                            <Style TargetType="sdk:DataGridColumnHeader">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Grid>
                                                <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                <TextBlock Text="Sun" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </sdk:DataGridTemplateColumn.HeaderStyle>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid Margin="0" Background="{Binding Color}">
                                    <CheckBox x:Name="SunCheck" HorizontalAlignment="Center" VerticalAlignment="Center"
                                              Click="SunCheck_Click"/>
                                </Grid>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn Width="65">
                        <sdk:DataGridTemplateColumn.HeaderStyle>
                            <Style TargetType="sdk:DataGridColumnHeader">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Grid>
                                                <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                <TextBlock Text="Mon" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </sdk:DataGridTemplateColumn.HeaderStyle>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid Margin="0" Background="{Binding Color}">
                                    <CheckBox x:Name="MonCheck" HorizontalAlignment="Center" VerticalAlignment="Center"
                                              Click="MonCheck_Click"/>
                                </Grid>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn Width="65">
                        <sdk:DataGridTemplateColumn.HeaderStyle>
                            <Style TargetType="sdk:DataGridColumnHeader">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Grid>
                                                <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                <TextBlock Text="Tues" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </sdk:DataGridTemplateColumn.HeaderStyle>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid Margin="0" Background="{Binding Color}">
                                    <CheckBox x:Name="TuesCheck" HorizontalAlignment="Center" VerticalAlignment="Center"
                                          Click="TuesCheck_Click"/>
                                </Grid>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn Width="65">
                        <sdk:DataGridTemplateColumn.HeaderStyle>
                            <Style TargetType="sdk:DataGridColumnHeader">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Grid>
                                                <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                <TextBlock Text="Wed" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </sdk:DataGridTemplateColumn.HeaderStyle>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid Margin="0" Background="{Binding Color}">
                                    <CheckBox x:Name="WedCheck" HorizontalAlignment="Center" VerticalAlignment="Center"
                                          Click="WedCheck_Click"/>
                                </Grid>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn Width="65">
                        <sdk:DataGridTemplateColumn.HeaderStyle>
                            <Style TargetType="sdk:DataGridColumnHeader">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Grid>
                                                <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                <TextBlock Text="Thur" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </sdk:DataGridTemplateColumn.HeaderStyle>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid Margin="0" Background="{Binding Color}">
                                    <CheckBox x:Name="ThurCheck" HorizontalAlignment="Center" VerticalAlignment="Center"
                                          Click="ThurCheck_Click"/>
                                </Grid>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn Width="65">
                        <sdk:DataGridTemplateColumn.HeaderStyle>
                            <Style TargetType="sdk:DataGridColumnHeader">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Grid>
                                                <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                <TextBlock Text="Fri" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </sdk:DataGridTemplateColumn.HeaderStyle>
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid Margin="0" Background="{Binding Color}">
                                    <CheckBox x:Name="FriCheck" HorizontalAlignment="Center" VerticalAlignment="Center"
                                              Click="FriCheck_Click"/>
                                </Grid>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </StackPanel>

        <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right" Margin="0,15,23,0">
            <Button x:Name="SaveButton" Content="Save" Click="SaveButton_Click" Width="75" Height="25" Margin="0,0,10,0"/>
            <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="25"/>
        </StackPanel>
    </Grid>
</controls:ChildWindow>